<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta name="Content-Type" content="text/html; charset=UTF-8" />
<title>Documentation by YARD 0.4.0</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>

  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a title="Index" href="_index.html">Index</a> &raquo; 
    <span class="title">File: README</span>
  
</div>

      <div id="search">
  <a id="class_list_link" href="#">Namespace List</a>
  <a id="method_list_link" href="#">Method List</a>
  <a id ="file_list_link" href="#">File List</a>
</div>

      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><div id='filecontents'><h1>Reflection</h1>
<p>
Reflection is designed to keep your development system in sync with your
production system&#8217;s files and database (by dumping). It uses a shared
git repository to store these files, which allows you to mirror your
production environment without the need of direct access to your production
servers.
</p>
<p>
It provides two main command modes:
</p>
<ul>
<li>Stash: Indented to be run on the server side, adds a specified directory
and, optionally, a database dump to a shared Git repository

</li>
<li>Apply: To be used on a local development machine, gets content from the
repository, copies it to a specified directory and optionally loads the
database dump into your local database

</li>
</ul>
<h2>Get it</h2>
<p>
Reflection is a gem, hosted on Gemcutter:
</p>
<pre class="code">
  <span class='gem identifier id'>gem</span> <span class='install identifier id'>install</span> <span class='gemcutter identifier id'>gemcutter</span>
  <span class='gem identifier id'>gem</span> <span class='tumble identifier id'>tumble</span>
  <span class='gem identifier id'>gem</span> <span class='install identifier id'>install</span> <span class='reflection identifier id'>reflection</span>
</pre>
<h2>Stashing your production data</h2>
<h4>The simplest form:</h4>
<pre class="code">
  $ <span class='reflection identifier id'>reflection</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='stash identifier id'>stash</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='directory identifier id'>directory</span> <span class='regexp val'>/path/</span><span class='to identifier id'>to</span><span class='div op'>/</span><span class='your identifier id'>your</span><span class='div op'>/</span><span class='assets identifier id'>assets</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span> <span class='git identifier id'>git</span><span class='@your ivar id'>@your</span><span class='minus op'>-</span><span class='shared identifier id'>shared</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span><span class='dot token'>.</span><span class='git identifier id'>git</span>
</pre>
<p>
This will clone <tt>git@your-shared-repository.git</tt> and add the
directory <tt>/path/to/your/assets</tt> to the repository. Reflection keeps
a local version of your repository in HOME/.reflection/stash. So the next
time you run the command, there is no need of cloning it again.
</p>
<h4>Now, lets include a database dump</h4>
<pre class="code">
  $ <span class='reflection identifier id'>reflection</span>  <span class='minus op'>-</span><span class='minus op'>-</span><span class='stash identifier id'>stash</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='directory identifier id'>directory</span> <span class='regexp val'>/path/</span><span class='to identifier id'>to</span><span class='div op'>/</span><span class='your identifier id'>your</span><span class='div op'>/</span><span class='assets identifier id'>assets</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span> <span class='git identifier id'>git</span><span class='@your ivar id'>@your</span><span class='minus op'>-</span><span class='shared identifier id'>shared</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span><span class='dot token'>.</span><span class='git identifier id'>git</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span> <span class='regexp val'>/rails/</span><span class='root identifier id'>root</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span><span class='minus op'>-</span><span class='env identifier id'>env</span> <span class='production identifier id'>production</span>
</pre>
<p>
This does the same as above, but additionally dumps your production
database and adds the fresh dump to your repository.
</p>
<h4>I&#8217;m lazy..</h4>
<p>
You too, aren&#8217;t you? So Reflection allows you to store all command
line options in a config file.
</p>
<pre class="code">
  $ <span class='reflection identifier id'>reflection</span>  <span class='minus op'>-</span><span class='minus op'>-</span><span class='stash identifier id'>stash</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='directory identifier id'>directory</span> <span class='regexp val'>/path/</span><span class='to identifier id'>to</span><span class='div op'>/</span><span class='your identifier id'>your</span><span class='div op'>/</span><span class='assets identifier id'>assets</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span> <span class='git identifier id'>git</span><span class='@your ivar id'>@your</span><span class='minus op'>-</span><span class='shared identifier id'>shared</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span><span class='dot token'>.</span><span class='git identifier id'>git</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span> <span class='regexp val'>/rails/</span><span class='root identifier id'>root</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span><span class='minus op'>-</span><span class='env identifier id'>env</span> <span class='production identifier id'>production</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='write identifier id'>write</span> <span class='regexp val'>/path/</span><span class='to identifier id'>to</span><span class='div op'>/</span><span class='your identifier id'>your</span><span class='div op'>/</span><span class='config identifier id'>config</span>
</pre>
<p>
The next time you want to run the same command as above (useful for cron),
you could simply call Reflection with:
</p>
<pre class="code">
  $ <span class='reflection identifier id'>reflection</span> <span class='div op'>/</span><span class='path identifier id'>path</span><span class='div op'>/</span><span class='to identifier id'>to</span><span class='div op'>/</span><span class='your identifier id'>your</span><span class='div op'>/</span><span class='config identifier id'>config</span>
</pre>
<h2>Getting the production stuff on your local development machine</h2>
<p>
This works exactly the same as describe above, but you would use
--apply instead of --stash:
</p>
<pre class="code">
  $ <span class='reflection identifier id'>reflection</span>  <span class='minus op'>-</span><span class='minus op'>-</span><span class='apply identifier id'>apply</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='directory identifier id'>directory</span> <span class='regexp val'>/path/</span><span class='to identifier id'>to</span><span class='div op'>/</span><span class='your identifier id'>your</span><span class='div op'>/</span><span class='assets identifier id'>assets</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span> <span class='git identifier id'>git</span><span class='@your ivar id'>@your</span><span class='minus op'>-</span><span class='shared identifier id'>shared</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span><span class='dot token'>.</span><span class='git identifier id'>git</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span> <span class='regexp val'>/rails/</span><span class='root identifier id'>root</span> \
                <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span><span class='minus op'>-</span><span class='env identifier id'>env</span> <span class='development identifier id'>development</span>
</pre>
<p>
This clones or pulls <tt>git@your-shared-repository.git</tt> (again,
Reflection keeps a version of your Repository in HOME/.reflection/apply),
copies the content to the specified directory (e.g.
rails/application/public/assets) and optionally loads the dump into your
database.
</p>
<p>
As you may have noticed, the Reflection command above got called with
<tt>--rails-env development</tt>, which loads the dump in your development
database (as defined by /rails/root/config/database.yml).
</p>
<h4>A little productivity hint</h4>
<p>
If you have a <tt>reflection.yml</tt> config file in your current
application-development-directory, syncing your server-production
environment is as easy as running:
</p>
<pre class="code">
  $ <span class='reflection identifier id'>reflection</span>
</pre>
<h2>reflection --help</h2>
<pre class="code">
  $ <span class='reflection identifier id'>reflection</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='help identifier id'>help</span>
  <span class='Usage constant id'>Usage</span><span class='colon op'>:</span> <span class='reflection identifier id'>reflection</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='COMMAND constant id'>COMMAND</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span><span class='assign token'>=</span><span class='GIT_REPO constant id'>GIT_REPO</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='directory identifier id'>directory</span><span class='assign token'>=</span><span class='PATH constant id'>PATH</span>
   <span class='minus op'>-</span><span class='or or kw'>or</span><span class='minus op'>-</span>
  <span class='Usage constant id'>Usage</span><span class='colon op'>:</span> <span class='reflection identifier id'>reflection</span> <span class='regexp val'>/path/</span><span class='to identifier id'>to</span><span class='div op'>/</span><span class='reflection identifier id'>reflection</span><span class='minus op'>-</span><span class='config identifier id'>config</span><span class='minus op'>-</span><span class='file identifier id'>file</span><span class='dot token'>.</span><span class='yml identifier id'>yml</span>

  <span class='On constant id'>On</span> <span class='the identifier id'>the</span> <span class='server identifier id'>server</span> <span class='side identifier id'>side</span><span class='colon op'>:</span>
      <span class='minus op'>-</span><span class='s identifier id'>s</span><span class='comma token'>,</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='stash identifier id'>stash</span>                      <span class='Store constant id'>Store</span> <span class='your identifier id'>your</span> <span class='assets identifier id'>assets</span> <span class='and and kw'>and</span><span class='regexp val'>/or a database dump in a git-repository.
  On the client side:
      -a, --apply                      Apply assets and/o</span><span class='r identifier id'>r</span> <span class='a identifier id'>a</span> <span class='database identifier id'>database</span> <span class='dump identifier id'>dump</span> <span class='loaded identifier id'>loaded</span> <span class='from identifier id'>from</span> <span class='a identifier id'>a</span> <span class='git identifier id'>git</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span><span class='dot token'>.</span>

  <span class='Required constant id'>Required</span> <span class='options identifier id'>options</span> <span class='for for kw'>for</span> <span class='both identifier id'>both</span><span class='colon op'>:</span>
      <span class='minus op'>-</span><span class='r identifier id'>r</span><span class='comma token'>,</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='repository identifier id'>repository</span> <span class='GIT_URL constant id'>GIT_URL</span>         <span class='A constant id'>A</span> <span class='Git constant id'>Git</span> <span class='repository identifier id'>repository</span><span class='lparen token'>(</span><span class='url identifier id'>url</span><span class='rparen token'>)</span> <span class='to identifier id'>to</span> <span class='be identifier id'>be</span> <span class='used identifier id'>used</span> <span class='as identifier id'>as</span> <span class='storage identifier id'>storage</span>
      <span class='minus op'>-</span><span class='d identifier id'>d</span><span class='comma token'>,</span> <span class='minus op'>-</span><span class='minus op'>-</span><span class='directory identifier id'>directory</span> <span class='PATH constant id'>PATH</span>             <span class='Path constant id'>Path</span> <span class='to identifier id'>to</span> <span class='your identifier id'>your</span> <span class='asset identifier id'>asset</span> <span class='directory identifier id'>directory</span>

  <span class='Additional constant id'>Additional</span> <span class='options identifier id'>options</span> <span class='for for kw'>for</span> <span class='both identifier id'>both</span><span class='colon op'>:</span>
          <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span> <span class='lbrack token'>[</span><span class='RAILS_ROOT constant id'>RAILS_ROOT</span><span class='rbrack token'>]</span>         <span class='Enable constant id'>Enable</span> <span class='dumping identifier id'>dumping</span><span class='div op'>/</span><span class='applying identifier id'>applying</span> <span class='of identifier id'>of</span> <span class='a identifier id'>a</span> <span class='Rails constant id'>Rails</span> <span class='managed identifier id'>managed</span> <span class='MySQL constant id'>MySQL</span> <span class='database identifier id'>database</span>
          <span class='minus op'>-</span><span class='minus op'>-</span><span class='rails identifier id'>rails</span><span class='minus op'>-</span><span class='env identifier id'>env</span> <span class='lbrack token'>[</span><span class='ENV constant id'>ENV</span><span class='rbrack token'>]</span>            <span class='Rails constant id'>Rails</span> <span class='environment identifier id'>environment</span> <span class='to identifier id'>to</span> <span class='instrument identifier id'>instrument</span>
          <span class='minus op'>-</span><span class='minus op'>-</span><span class='write identifier id'>write</span> <span class='lbrack token'>[</span><span class='FILE constant id'>FILE</span><span class='rbrack token'>]</span>               <span class='Create constant id'>Create</span> <span class='a identifier id'>a</span> <span class='configuration identifier id'>configuration</span> <span class='FILE constant id'>FILE</span> <span class='from identifier id'>from</span> <span class='the identifier id'>the</span> <span class='current identifier id'>current</span> <span class='commandline identifier id'>commandline</span> <span class='options identifier id'>options</span>
</pre>
<h2>Note on Patches/Pull Requests</h2>
<ul>
<li>Fork the project.

</li>
<li>Make your feature addition or bug fix.

</li>
<li>Add specs for it. This is important so I don&#8217;t break it in a future
version unintentionally.

</li>
<li>Commit, do not mess with rakefile, version, or history. (if you want to
have your own version, that is fine but bump version in a commit by itself
I can ignore when I pull)

</li>
<li>Send me a pull request. Bonus points for topic branches.

</li>
</ul>
<h2>Copyright</h2>
<p>
Copyright &#169; 2009 Andreas Wolff. See LICENSE for details.
</p>
</div></div>
    
    <div id="footer">
  Generated on Wed Nov 18 18:17:10 2009 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
  0.4.0 (ruby-1.8.7).
</div>

  </body>
</html>